home *** CD-ROM | disk | FTP | other *** search
/ American History: Interactive Maps & User's Guide / American History: Interactive Maps & User's Guide.iso / pc / IMAP10 / xIMAP10.dxr / 00388_CC handlers.ls < prev    next >
Encoding:
Text File  |  2000-01-25  |  6.8 KB  |  194 lines

  1. on hCCInitialSetup ccChannel
  2.   global gintClosedCaptionStatus, gCCtext, gCCtextChannel, gCCtextnum
  3.   set gCCtextnum to the number of member "ccTextBox"
  4.   set gintClosedCaptionStatus to -1
  5.   set gCCtext to "cctext 3 empty lines"
  6.   set gCCtextChannel to ccChannel
  7.   set the text of member gCCtextnum to " "
  8.   set the loc of sprite gCCtextChannel to point(320, 428)
  9.   puppetSprite(gCCtextChannel, 1)
  10.   hCCScrollBoxInit()
  11.   set the memberNum of sprite gCCtextChannel to member "cc avail buttonU"
  12.   set the ink of sprite gCCtextChannel to 8
  13.   set the visible of sprite gCCtextChannel to 1
  14.   updateStage()
  15. end
  16.  
  17. on hPlayNarrationFile intSoundChannel, textFileName
  18.   global gCCtext, gintClosedCaptionStatus
  19.   if gintClosedCaptionStatus < 0 then
  20.     set gintClosedCaptionStatus to -1 * gintClosedCaptionStatus
  21.     if the platform contains "Windows" then
  22.       sound playFile intSoundChannel, the pathName & "audio\" & textFileName
  23.     else
  24.       sound playFile intSoundChannel, the pathName & "audio:" & textFileName
  25.     end if
  26.     set gCCtext to textFileName
  27.     if gintClosedCaptionStatus > 1 then
  28.       hCCSetupText()
  29.       startTimer()
  30.     end if
  31.   end if
  32. end
  33.  
  34. on hCCSetupText
  35.   global gintClosedCaptionStatus, gCCtextnum, gCCtext, gCCtextChannel, gintCCTextLines
  36.   put the text of member gCCtext into field gCCtextnum
  37.   set the scrollTop of member gCCtextnum to 0
  38.   if (the name of member the memberNum of sprite gCCtextChannel <> "ccTextBox") and (abs(gintClosedCaptionStatus) > 1) then
  39.     set the castNum of sprite gCCtextChannel to member "ccTextBox"
  40.     set the ink of sprite gCCtextChannel to 0
  41.   end if
  42.   updateStage()
  43.   set gintCCTextLines to the lineCount of member gCCtextnum
  44. end
  45.  
  46. on hCCNarrationCompletionCheck intSoundChannel, intAnotherNarrFlag, intJumpLocation
  47.   global gintClosedCaptionStatus, gCCtextnum, gintCCTextLines
  48.   if gintClosedCaptionStatus > 1 then
  49.     if gintCCTextLines <= 3 then
  50.       if the timer >= (gintCCTextLines * gintClosedCaptionStatus * 60) then
  51.         set gintClosedCaptionStatus to -1 * gintClosedCaptionStatus
  52.       end if
  53.     else
  54.       if the timer >= (3 * gintClosedCaptionStatus * 60) then
  55.         set gintCCTextLines to gintCCTextLines - 3
  56.         scrollByLine(member gCCtextnum, 3)
  57.         startTimer()
  58.       end if
  59.     end if
  60.   end if
  61.   if (soundBusy(intSoundChannel) = 1) or (gintClosedCaptionStatus > 1) then
  62.     if gintClosedCaptionStatus < 0 then
  63.       set gintClosedCaptionStatus to gintClosedCaptionStatus * -1
  64.     end if
  65.     if the frame < (intJumpLocation - 1) then
  66.       go(the frame + 1)
  67.     else
  68.       go(the frame)
  69.     end if
  70.   else
  71.     if gintClosedCaptionStatus > 0 then
  72.       set gintClosedCaptionStatus to -1 * gintClosedCaptionStatus
  73.     end if
  74.     if intAnotherNarrFlag = 0 then
  75.       hCCEndNarration()
  76.       updateStage()
  77.     end if
  78.     set the text of member gCCtextnum to " "
  79.     if intJumpLocation = 0 then
  80.       go(the frame)
  81.     else
  82.       go(the frame + 1)
  83.     end if
  84.   end if
  85. end
  86.  
  87. on hCCSetScrollRate mouseY
  88.   global gintClosedCaptionStatus, gCCtextnum, gCCtextChannel
  89.   set intMenuSelection to (mouseY - the top of sprite gCCtextChannel) / 14
  90.   set stringCurrentButton to the name of member the castNum of sprite gCCtextChannel
  91.   case intMenuSelection of
  92.     2:
  93.       set tempClosedCaptionStatus to -1
  94.       set the castNum of sprite gCCtextChannel to the number of member stringCurrentButton + 1
  95.     3:
  96.       set tempClosedCaptionStatus to -4
  97.       set the castNum of sprite gCCtextChannel to the number of member stringCurrentButton + 2
  98.     4:
  99.       set tempClosedCaptionStatus to -3
  100.       set the castNum of sprite gCCtextChannel to the number of member stringCurrentButton + 3
  101.     5:
  102.       set tempClosedCaptionStatus to -2
  103.       set the castNum of sprite gCCtextChannel to the number of member stringCurrentButton + 4
  104.     otherwise:
  105.       set tempClosedCaptionStatus to -1 * abs(gintClosedCaptionStatus)
  106.   end case
  107.   updateStage()
  108.   set waitTicks to 30
  109.   set currTicks to the timer
  110.   repeat while the timer < (currTicks + waitTicks)
  111.     nothing()
  112.   end repeat
  113.   if tempClosedCaptionStatus = -1 then
  114.     set the castNum of sprite gCCtextChannel to member "cc avail buttonU"
  115.     set the ink of sprite gCCtextChannel to 8
  116.     set the text of member gCCtextnum to " "
  117.     if gintClosedCaptionStatus > 0 then
  118.       set gintClosedCaptionStatus to tempClosedCaptionStatus * -1
  119.     else
  120.       set gintClosedCaptionStatus to tempClosedCaptionStatus
  121.     end if
  122.   else
  123.     if gintClosedCaptionStatus > 0 then
  124.       set the castNum of sprite gCCtextChannel to member "ccTextBox"
  125.       hCCSetupText()
  126.       startTimer()
  127.       set gintClosedCaptionStatus to tempClosedCaptionStatus * -1
  128.     else
  129.       set the castNum of sprite gCCtextChannel to member "cc on buttonU"
  130.       set the ink of sprite gCCtextChannel to 8
  131.       set gintClosedCaptionStatus to tempClosedCaptionStatus
  132.     end if
  133.   end if
  134.   updateStage()
  135. end
  136.  
  137. on hCCIconClicked mouseY
  138.   global gCCtext, gintClosedCaptionStatus, gCCtextChannel
  139.   set thisSprite to the clickOn
  140.   set thisSpriteCast to the name of member the castNum of sprite thisSprite
  141.   delete char the number of chars in thisSpriteCast of thisSpriteCast
  142.   case thisSpriteCast of
  143.     "cc avail button", "cc on button":
  144.       set the ink of sprite gCCtextChannel to 8
  145.       set the castNum of sprite gCCtextChannel to member (thisSpriteCast & "menu" & "U")
  146.     "cc avail buttonmenu", "cc on buttonmenu":
  147.       hCCSetScrollRate(mouseY)
  148.     "ccTextBox":
  149.       set the castNum of sprite gCCtextChannel to member "cc on buttonmenuU"
  150.       set the ink of sprite gCCtextChannel to 8
  151.     otherwise:
  152.       nothing()
  153.   end case
  154.   updateStage()
  155.   call(#init, the scriptInstanceList of sprite thisSprite)
  156. end
  157.  
  158. on hCCScrollBoxInit
  159.   global gCCtext, gCCtextnum, gCCtextChannel
  160.   put the text of member "cctext 3 empty lines" into field gCCtextnum
  161.   if the machineType = 256 then
  162.     set the textFont of member gCCtextnum to "Arial"
  163.     set the textSize of member gCCtextnum to 12
  164.     set the backcolor of member gCCtextnum to 252
  165.   else
  166.     set the textFont of member gCCtextnum to "Helvetica"
  167.     set the textSize of member gCCtextnum to 14
  168.     set the backcolor of member gCCtextnum to 253
  169.   end if
  170.   set the textStyle of member gCCtextnum to "plain"
  171.   set the foreColor of member gCCtextnum to 0
  172.   set the boxType of member gCCtextnum to #fixed
  173.   put the text of member gCCtext into field gCCtextnum
  174. end
  175.  
  176. on hCCCleanUp
  177.   global gCCtextChannel, gCCtextnum
  178.   puppetSprite(gCCtextChannel, 0)
  179.   set the text of member gCCtextnum to " "
  180. end
  181.  
  182. on hCCEndNarration
  183.   global gintClosedCaptionStatus, gCCtextChannel, gCCtextnum
  184.   set stringCurrentButton to the name of member the castNum of sprite gCCtextChannel
  185.   set the text of member gCCtextnum to " "
  186.   case stringCurrentButton of
  187.     "ccTextBox":
  188.       set the castNum of sprite gCCtextChannel to member "cc on buttonU"
  189.       set the ink of sprite gCCtextChannel to 8
  190.     otherwise:
  191.       nothing()
  192.   end case
  193. end
  194.